{
 "cells": [
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "Occlusion experiment-"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "import keras\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import math\n",
    "import seaborn as sns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "mnist=keras.datasets.mnist\n",
    "(x_train,y_train), (x_test,y_test)=mnist.load_data()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "x_train = x_train.reshape(x_train.shape[0], 28, 28,1).astype('float32')\n",
    "x_test = x_test.reshape(x_test.shape[0], 28, 28,1).astype('float32')\n",
    "x_train=x_train/255.0\n",
    "x_test=x_test/255.0\n",
    "y_train=keras.utils.to_categorical(y_train)\n",
    "y_test=keras.utils.to_categorical(y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Load pretrained convnet\n",
    "model=keras.models.load_model(r\"C:\\Users\\USER\\Desktop\\inverting convolutional layers\\Max pooling\\model.pkl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1, 28, 28, 1)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "image=np.expand_dims(x_train[4],axis=0)\n",
    "image.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "\n",
    "\n",
    "occluding_size = 4 \n",
    "occluding_pixel = 0\n",
    "occluding_stride = 4\n",
    "\n",
    "_,height, width,_= image.shape\n",
    "\n",
    "output_height = int(math.ceil((height-occluding_size)/occluding_stride+1))\n",
    "output_width = int(math.ceil((width-occluding_size)/occluding_stride+1))\n",
    "\n",
    "heatmap = np.zeros((output_height, output_width))\n",
    "\n",
    "for h in range(output_height):\n",
    "    for w in range(output_width):\n",
    "        #occluder region\n",
    "        h_start = h*occluding_stride\n",
    "        w_start = w*occluding_stride\n",
    "        h_end = min(height, h_start + occluding_size)\n",
    "        w_end = min(width, w_start + occluding_size)\n",
    "\n",
    "        input_image = np.array(image, copy=True) \n",
    "        input_image[:,h_start:h_end,w_start:w_end,:] =  occluding_pixel\n",
    "        probs = model.predict(input_image)[0]\n",
    "        heatmap[h,w] = probs[9] # the probability of the correct class\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAbMAAAE5CAYAAAAaxs45AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAD9FJREFUeJzt3V9o1ff9x/FXjCaKxxaFObRgRktT\nNttVjltXKAqthm7Ui5axktGOXrSu3Y03zhVay7wIqbvoTbfVUWhlKLXp/l1MGR32woB6ozQXsVsK\n3WBbKRWmQ5OlhJjzuyg9rNtvpkvNsrc+HpCLr98cvp9A4jPv7/l8taPVarUCAIUtWugFAMCnJWYA\nlCdmAJQnZgCUJ2YAlCdmAJQnZgCUt3ihFwDAwvs0jxx3dHRcwZXMjckMgPJMZgCUn8zEDIBPFbP/\nBWIGgJgBUJ+YAVCemAFQXvWY2ZoPQHkmMwDKT2ZiBoCYAVCfmAFQnpgBUF71mNnNCEB5JjMAyk9m\nYgaAmAFQn5gBUJ6YAVCemAFQXvWY2ZoPQHkmMwDKT2ZiBoCYAVCfmAFQnpgBUJ6YAVBe9ZjZmg9A\neSYzAMpPZmIGgJgBUJ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36stexmxGAtFqtOX9czvj4eBqNRvu4s7Mz\n09PTH/ucn//85/nqV7+aVatWJUluvPHG7NixIwcPHszWrVszMDAw6/rFDIB502g0MjEx0T6emZnJ\n4sUfvyn461//Ot/4xjfax3feeWe+8pWvJEn6+vry1ltvzXodMQNg3iazZrOZ4eHhJB9u8PhoU8dH\nLl68mKmpqaxZs6b9Z7t3787rr7+eJDl58mTWr18/6/q9ZwbAvL1n1tfXl+PHj6e/vz+tViuDg4PZ\nv39/1q1bly1btuSPf/xjbrjhho+9ZufOnXnqqady6NChLFu27BPdZuxoVX+4gNLefffdhV7CFfPP\nP5BQyT9PTP+Jt99++wquZG5MZgB4aBo+jc9+9rMLvQQgYgbAVaB6zOxmBKA8kxkA5SczMQNAzACo\nT8wAKE/MAChPzAAor3rMbM0HoDyTGQDlJzMxA0DMAKhPzAAoT8wAKE/MACivesxszQegPJMZAOUn\nMzEDQMwAqE/MAChPzAAoT8wAKK96zGzNB6A8kxkA5SczMQNAzACoT8wAKE/MAChPzAAor3rMbM0H\noDyTGQDlJzMxA0DMAKhPzAAoT8wAKE/MACivesxszQegPJMZAOUnMzEDQMwAqE/MACivesw6WtW/\nAgCueXYzAlCemAFQnpgBUJ6YAVCemAFQnpgBUN7/AZkVEmWZjQNiAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 576x396 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig = sns.heatmap(heatmap,xticklabels=False, yticklabels=False,cmap=\"gray\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUsAAAFJCAYAAAASfw+VAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBo\ndHRwOi8vbWF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sAMCCWAGBALAHAgG/rRdCdP3/ePPbrr782jTtw4IB5n7///rvX7R0dHYqKijLv57927txp\nHjt48GDz2B9//NE89t13371nW0pKyj3/vVNSUsz7xP2xsgQAA2IJAAbEEgAMiCUAGBBLADAglgBg\nQCwBwIBYAoABsQQAA67ggV9+++0389hZs2aZxzY2NprG+XIH5zfffNP8s4sXL5r2+c4775if3xe+\nHFdTU9M92zZu3KiysrJ7tuHhsbIEAANiCQAGxBIADIglABgQSwAwIJYAYEAsAcCAWAKAAbEEAANi\nCQAGXO74GOjs7DSP9XZzsbS0NJ09e/aOba+99pp5nx6Pxzx22rRppnFut9u8z2HDht33Z7t3777j\ncUdHh2mfeXl55ue/+zkC5aWXXvJpOx4OK0sAMCCWAGBALAHAgFgCgAGxBAADYgkABsQSAAyIJQAY\nEEsAMCCWAGDgcny5nRx6pMrKSvPYrKyse7a1t7crOtr/K2Nnz55tHrt9+3bTuD59+vg7nW798ssv\npnGvvPJKUJ4/OTnZPPb48eP3bOvXr5/++eefe7bh4bGyBAADUyxra2uVk5MjSbpw4YLmzJmj7Oxs\nrV271qcvaQCAnuqBsdy6datWrVql27dvS5I2bNigwsJC7dq1S47j+PQWDwB6qgfGMikpSeXl5V2P\n6+vrNW7cOEnShAkTdOjQoeDNDgAixAM/tc/KytKlS5e6HjuOI5fLJUmKjY3VjRs3gjc7BIQvJyPa\n29t92v6omThxomlcJP/34IROcPh8irNXr/8tRltaWhQfHx/QCSHwOBtux9lw3I/PZ8PT09NVXV0t\nSaqqqtLYsWMDPikAiDQ+x7KoqEjl5eWaPXu22travK5EAOBRY3pvNWjQIFVUVEiSUlNT9c033wR1\nUgAQabiCp4f64osvzGM/+OAD89h/T979l7fPLNesWWPeZ1FRkXlssD6LtHruuedM47x9XhgIR44c\nMY/lI7DQ4goeADAglgBgQCwBwIBYAoABsQQAA2IJAAbEEgAMiCUAGBBLADAglgBg4P/3biEotmzZ\nYhrnyyWMvlxC+Pbbb3vdnpube8fjFStWmPcZExNjHm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pI0YcIEHTp0KFxT89vdx1RXV6eD\nBw9q7ty5Ki4ulsfjCePs/DNp0iQtXry463FUVFSPf628HVOkvFYhj6XH41FcXFzX46ioKLW3t4d6\nGgHXt29f5efna9u2bfr444+1dOnSHntcWVlZio7+3yc0juPI5XJJkmJjY3Xjxo1wTc1vdx/Ts88+\nq48++kg7d+7U4MGDtXHjxjDOzj+xsbGKi4uTx+PRokWLVFhY2ONfK2/HFCmvVchjGRcXp5aWlq7H\nnZ2dd/xP3FOlpqbqjTfekMvlUmpqqhISEtTU1BTuaQXEfz/zamlpUXx8fBhnExiZmZkaNWpU159P\nnDgR5hn558qVK8rNzdXUqVM1ZcqUR+K1uvuYIuW1CnksMzIyVFVVJUmqqanR8OHDQz2FoNi7d69K\nS0slSY2NjfJ4PBowYECYZxUY6enpqq6uliRVVVVp7NixYZ7Rw8vPz9exY8ckSYcPH9bIkSPDPCPf\nXb16VXl5eVq2bJlmzJghqee/Vt6OKVJeq5DfN/zfs+GnT5+W4zhav369hgwZEsopBEVra6tWrFih\ny5cvy+VyaenSpcrIyAj3tPx26dIlLVmyRBUVFTp37pxWr16ttrY2paWlye12KyoqKtxT9Nl/j6m+\nvl4lJSWKiYlRYmKiSkpK7vh4qCdwu93av3+/0tLSuratXLlSbre7x75W3o6psLBQZWVlYX+tQh5L\nAOiJes4vYAFAGBFLADAglgBgQCwBwIBYAoABsQQAA2IJAAbEEgAM/g9+ctwZmJjmVwAAAABJRU5E\nrkJggg==\n",
      "text/plain": [
       "<Figure size 576x396 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#Original image\n",
    "fig=plt.imshow(np.squeeze(x_train[4]))\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
